//前端所有的请求地址 集合
import ajax from './ajax'

//前端请求地址 --》 mock
import ajaxMock  from './ajaxMock'

//get 获取导航栏
export const reqBaseCategoryList = ()=>ajax.get(`/product/getBaseCategoryList`) 

//get 获取首页轮播图数据
export const reqBanners = ()=>ajax.get(`/cms/banner`) 

//get 获取搜索页的商品数据
export const reqProductList = (searchParams) => ajax.post('/list',searchParams)

//mockGet 获取今日推荐的数据
export const reqRecommends = () => ajaxMock.get('/today') 

//mockGet 获取楼层的数据
export const reqFloors = () => ajaxMock.get('/floor')

//get 商品详情页 --- 商品信息  
export const reqDetailInfo = (skuId) => ajax.get(`/item/${skuId}`)

//get 商品详情页 --- 优惠券和活动  
export const reqActivityAndCoupon = (skuId) => ajax.get(`/activity/findActivityAndCoupon/${skuId}`)

/** 用户信息的相关操作**/
//post 登录
export const reqLogin = (phone,password)=>ajax.post(`/user/passport/login`,{phone,password})
//post 注册
export const reqRegister = (userInfo)=>ajax.post(`/user/passport/register`,userInfo)
//get 发送验证码
export const reqSendCode = (phone)=>ajax.get(`/user/passport/sendCode/${phone}`)
//get 获取用户信息
export const reqUserInfo = ()=>ajax.get(`/user/passport/auth/getUserInfo`)
//get 退出
export const reqLogout = ()=>ajax.get(`/user/passport/logout`)
/** 用户信息的相关操作**/

/** 用户信息的相关操作--地址相关**/
//get 获取大区区域
export const reqBaseRegion = ()=>ajax.get(`/user/userAddress/auth/findBaseRegion`)
//get 获取大区下的省份接口
export const reqBaseProvince = (regionId)=>ajax.get(`/user/userAddress/auth/findBaseProvinceByRegionId/${regionId}`)

//get 获取用户地址信息
export const reqUserAddressList =  ()=>ajax.get(`/user/userAddress/auth/findUserAddressList`)
//post 新增用户地址
export const reqAddUserAddress = (userAddressInfo)=>ajax.post(`/user/userAddress/auth/save`,userAddressInfo)
//post 更新用户地址
export const reqUpdateUserAddress = (userAddressInfo)=>ajax.post(`/user/userAddress/auth/update`,userAddressInfo)
//get 删除用户地址
export const reqDelUserAddress = (userAddressId)=>ajax.get(`/user/userAddress/auth/delete/${userAddressId}`)
/** 用户信息的相关操作--地址相关**/

/** trade 页相关接口  2个 */
//get 获取订单列表
export const reqGetOrderList = (page,limit) => ajax.get(`/order/auth/${page}/${limit}`)
//get  获取订单商品详情信息
export const reqGetOrderGoodsDetail=  (orderId)=>ajax.get(`/order/auth/getOrderDetail/${orderId}`)

//get  获取订单详情信息数据
export const reqGetOrderDetail=  (orderId)=>ajax.get(`/order/auth/${orderId}`)

//get 获取订单支付接口
export const reqNativeInfo  = (payInfoId) =>ajax.get(`/payment/weixin/createNative/${payInfoId}`)

//get 获取订单支付成功与否
export const reqPayStatus  = (orderId)=>ajax.get(`/payment/weixin/queryPayStatus/${orderId}`)

//post 提交订单
export const reqSubmitOrder = (tradeNo, tradeInfo) => ajax.post(`/order/auth/submitOrder?tradeNo=${tradeNo}`,tradeInfo)

//get 获取订单交易页信息【trade页的信息】
export const reqGetTradeInfo = ()=>ajax.get(`/order/auth/trade`)

/*  退货  3个接口*/
//get 获取退货列表数据
export const reqGetReverseOrders=  (page,limit)=>ajax.get(`/order/orderRefundInfo/auth/${page}/${limit}`)

//post 发起退货
export const reqReverseOrder = (orderRefundInfo)=>ajax.post(`/order/orderRefundInfo/auth/save`,orderRefundInfo)

//post 退货进度追踪
export const reqReverseOrderTrack = (id,trackingNo)=>ajax.post(`/order/orderRefundInfo/auth/delevered/${id}/${trackingNo}`)
/*  退货  */

/** trade 页相关接口 */



//get  领取优惠券
export const reqGetCouponInfo = (couponId)=> ajax.get(`/activity/auth/getCouponInfo/${couponId}`)

/**  购物车的相关接口 */
//get 购物车列表
export const reqGetShopCartList = () => ajax.get(`/cart/cartList`)

//post 添加到购物车
export const reqAddToCart = (skuId,skuNum) => ajax.post(`/cart/addToCart/${skuId}/${skuNum}`)

//get切换商品选中状态
export const reqCheckCart = (skuId,isChecked) => ajax.get(`/cart/checkCart/${skuId}/${isChecked}`)
//post 批量切换商品选中状态
export const reqCheckCarts = (skuIdList,isChecked) => ajax.post(`/cart/batchCheckCart/${isChecked}`,skuIdList)

//delete之删除购物车商品
export const reqDeleteCart = (skuId) => ajax.delete(`/cart/deleteCart/${skuId}`)
//delete之批量删除购物车商品
export const reqDeleteCarts = (skuIdList) => ajax.delete(`/cart/batchDeleteCart`,{data:skuIdList})

/**  购物车的相关接口 */